import QtQuick

Item {
    id: manipulationBack_DebugProcess
    width: 1760
    height: 935

    property real fontSize: Cpp_Language.CurrentLanguage === 1 ? 40 : Cpp_Language.CurrentLanguage === 2 ? 25 : Cpp_Language.CurrentLanguage === 3 ? 25 : 40
    property real button_width: 200
    property real button_height: 80


    Rectangle{
        anchors.left: parent.left
        anchors.leftMargin: 5
        anchors.top: parent.top
        anchors.topMargin: 5
        width: 870
        height: 830
        border.width: 1
        color: "transparent"

        Rectangle{
            width: 200
            height: 60
            anchors.top: parent.top
            anchors.topMargin: 10
            anchors.horizontalCenter: parent.horizontalCenter
            color: "transparent"

            Text{
                anchors.centerIn: parent
                font.pixelSize: fontSize
                font.bold: true
                text: qsTr("左 机 头")
            }

        }

        Column{
            anchors.top: parent.top
            anchors.topMargin: 80
            anchors.horizontalCenter: parent.horizontalCenter
            spacing: 30

            Item{
                width: 830
                height: 70

                Row{
                    anchors.centerIn: parent
                    spacing: 50

                    A_Button{
                        buttonWidth: button_width
                        buttonHeight: button_height
                        contentText_Data: qsTr("45度")
                        isSelected: Cpp_PLC.Y4

                        onButtonPressed: Cpp_PLC.write_into_PLC_Coils(13,true)
                        onButtonReleased: Cpp_PLC.write_into_PLC_Coils(13,false)
                    }
                    A_Button{
                        buttonWidth: button_width
                        buttonHeight: button_height
                        contentText_Data: qsTr("90度")
                        isSelected: Cpp_PLC.Y5

                        onButtonPressed: Cpp_PLC.write_into_PLC_Coils(15,true)
                        onButtonReleased: Cpp_PLC.write_into_PLC_Coils(15,false)
                    }
                }

            }
            Item{
                width: 830
                height: 70


                A_Button{
                    buttonWidth: button_width
                    buttonHeight: button_height
                    anchors.centerIn: parent
                    contentText_Data: qsTr("锯片启动")
                    isSelected: Cpp_PLC.Y2

                    onButtonPressed: Cpp_PLC.write_into_PLC_Coils(11,true)
                    onButtonReleased: Cpp_PLC.write_into_PLC_Coils(11,false)
                }


            }
            Item{
                width: 830
                height: 70

                A_Button{
                    buttonWidth: button_width
                    buttonHeight: button_height
                    anchors.centerIn: parent
                    contentText_Data: qsTr("压  料")
                    isSelected: Cpp_PLC.Y12

                    onButtonPressed: Cpp_PLC.write_into_PLC_Coils(19,true)
                    onButtonReleased: Cpp_PLC.write_into_PLC_Coils(19,false)
                }

            }
            Item{
                width: 830
                height: 70

                A_Button{
                    buttonWidth: button_width
                    buttonHeight: button_height
                    anchors.centerIn: parent
                    contentText_Data: qsTr("工  进")
                    isSelected: Cpp_PLC.Y10

                    onButtonPressed: Cpp_PLC.write_into_PLC_Coils(17,true)
                    onButtonReleased: Cpp_PLC.write_into_PLC_Coils(17,false)
                }

            }
            Item{
                width: 830
                height: 70

                A_Button{
                    buttonWidth: button_width
                    buttonHeight: button_height
                    anchors.centerIn: parent
                    contentText_Data: qsTr("拉  料")

                    isSelected: Cpp_PLC.Y23

                    onButtonPressed: Cpp_PLC.write_into_PLC_Coils(198,true)
                    onButtonReleased: Cpp_PLC.write_into_PLC_Coils(198,false)
                }
            }
        }


        A_ComboBox{
            anchors.left: parent.left
            anchors.leftMargin: 10
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 170
            comboBoxWidth: 300
            comboBoxHeight: 80
            contentText_Fontsize: fontSize
            currentIndex: Cpp_Config.CurrentLanguage-1
            itemHeight: 80
            model: ["中文","English","Việt nam"]

            onComboBoxActivated: {
                Cpp_Language.load_Language(currentIndex+1)
                Cpp_Language.CurrentLanguage = currentIndex+1

                Cpp_Config.CurrentLanguage = currentIndex+1
                Cpp_Printer.CurrentLanguage = currentIndex+1
            }

        }

        A_Button{
            anchors.right: parent.right
            anchors.rightMargin: 10
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 170
            buttonWidth: 220
            buttonHeight: 80
            visible: Cpp_PLC.M_505
            contentText_Data: qsTr("清除电池报警")

            onButtonPressed: Cpp_PLC.write_into_PLC_Coils(194,true)
            onButtonReleased: Cpp_PLC.write_into_PLC_Coils(194,false)
        }


    }


    Rectangle{
        anchors.right: parent.right
        anchors.rightMargin: 5
        anchors.top: parent.top
        anchors.topMargin: 5
        width: 870
        height: 830
        border.width: 1
        color: "transparent"

        Rectangle{
            width: 200
            height: 60
            anchors.top: parent.top
            anchors.topMargin: 10
            anchors.horizontalCenter: parent.horizontalCenter
            color: "transparent"

            Text{
                anchors.centerIn: parent
                font.pixelSize: fontSize
                font.bold: true
                text: qsTr("右 机 头")
            }

        }


        Column{
            anchors.top: parent.top
            anchors.topMargin: 80
            anchors.horizontalCenter: parent.horizontalCenter
            spacing: 30

            Item{
                width: 830
                height: 70

                Row{
                    anchors.centerIn: parent
                    spacing: 50

                    A_Button{
                        buttonWidth: button_width
                        buttonHeight: button_height
                        contentText_Data: qsTr("45度")
                        isSelected: Cpp_PLC.Y6

                        onButtonPressed: Cpp_PLC.write_into_PLC_Coils(14,true)
                        onButtonReleased: Cpp_PLC.write_into_PLC_Coils(14,false)
                    }
                    A_Button{
                        buttonWidth: button_width
                        buttonHeight: button_height
                        contentText_Data: qsTr("90度")
                        isSelected: Cpp_PLC.Y7

                        onButtonPressed: Cpp_PLC.write_into_PLC_Coils(16,true)
                        onButtonReleased: Cpp_PLC.write_into_PLC_Coils(16,false)
                    }
                }

            }
            Item{
                width: 830
                height: 70


                A_Button{
                    buttonWidth: button_width
                    buttonHeight: button_height
                    anchors.centerIn: parent
                    contentText_Data: qsTr("锯片启动")
                    isSelected: Cpp_PLC.Y3

                    onButtonPressed: Cpp_PLC.write_into_PLC_Coils(12,true)
                    onButtonReleased: Cpp_PLC.write_into_PLC_Coils(12,false)
                }


            }
            Item{
                width: 830
                height: 70

                A_Button{
                    buttonWidth: button_width
                    buttonHeight: button_height
                    anchors.centerIn: parent
                    contentText_Data: qsTr("压  料")                    
                    isSelected: Cpp_PLC.Y13

                    onButtonPressed: Cpp_PLC.write_into_PLC_Coils(20,true)
                    onButtonReleased: Cpp_PLC.write_into_PLC_Coils(20,false)
                }

            }
            Item{
                width: 830
                height: 70

                A_Button{
                    buttonWidth: button_width
                    buttonHeight: button_height
                    anchors.centerIn: parent
                    contentText_Data: qsTr("工  进")
                    isSelected: Cpp_PLC.Y11

                    onButtonPressed: Cpp_PLC.write_into_PLC_Coils(18,true)
                    onButtonReleased: Cpp_PLC.write_into_PLC_Coils(18,false)
                }

            }
            Item{
                width: 830
                height: 70

                A_Button{
                    buttonWidth: button_width
                    buttonHeight: button_height
                    anchors.centerIn: parent
                    contentText_Data: qsTr("外摆拽料")

                    isSelected: Cpp_PLC.Y21

                    onButtonPressed: Cpp_PLC.write_into_PLC_Coils(171,true)
                    onButtonReleased: Cpp_PLC.write_into_PLC_Coils(171,false)
                }
            }
            Item{
                width: 830
                height: 70

                Row{
                    anchors.centerIn:  parent
                    spacing: 50


                    A_Button{
                        buttonWidth: button_width
                        buttonHeight: button_height
                        contentText_Data: qsTr("吹气阀")                    

                        onButtonPressed: Cpp_PLC.write_into_PLC_Coils(235,true)
                        onButtonReleased: Cpp_PLC.write_into_PLC_Coils(235,false)
                    }

                    A_Button{
                        buttonWidth: button_width
                        buttonHeight: button_height
                        contentText_Data: qsTr("料高气缸")

                        isSelected: Cpp_PLC.Y14

                        onButtonPressed: Cpp_PLC.write_into_PLC_Coils(101,true)
                        onButtonReleased: Cpp_PLC.write_into_PLC_Coils(101,false)
                    }

                    A_Button{
                        buttonWidth: button_width
                        buttonHeight: button_height
                        contentText_Data: qsTr("读取位置")

                        onButtonPressed: Cpp_PLC.write_into_PLC_Coils(53,true)
                        onButtonReleased: Cpp_PLC.write_into_PLC_Coils(53,false)
                    }
                }
            }
            Item{
                width: 830
                height: 70
                visible: Cpp_PLC.M_396

                Row{
                    anchors.centerIn:  parent
                    spacing: 50


                    Rectangle{
                        width: 200
                        height: 80
                        border.width: 3
                        radius: 5
                        border.color: "white"
                        color: "black"

                        Text{
                            anchors.centerIn: parent
                            font.pixelSize: fontSize
                            font.bold: true
                            color: "white"
                            text: Cpp_PLC.MaterialHeightObserveValue
                        }

                    }

                    A_Button{
                        buttonWidth: button_width
                        buttonHeight: button_height
                        contentText_Data: qsTr("测  高")

                        onButtonPressed: Cpp_PLC.write_into_PLC_Coils(108,true)
                        onButtonReleased: Cpp_PLC.write_into_PLC_Coils(108,false)
                    }

                    A_Button{
                        buttonWidth: button_width
                        buttonHeight: button_height
                        contentText_Data: qsTr("误差修正")

                        onButtonPressedAndHold: Cpp_PLC.write_into_PLC_Coils(110,true)
                    }
                }
            }
        }



    }


    // Rectangle{
    //     width: 1200
    //     height: 1
    //     color: "black"
    //     anchors.horizontalCenter: manipulationBack_DebugProcess.horizontalCenter
    //     anchors.bottom: manipulationBack_DebugProcess.bottom
    //     anchors.bottomMargin: 100
    // }

    Rectangle{      // 超短加工 - 手动操作按钮
        anchors.horizontalCenter: manipulationBack_DebugProcess.horizontalCenter
        anchors.bottom: manipulationBack_DebugProcess.bottom
        anchors.bottomMargin: 10
        width: 1750
        height: 80
        color: "transparent"

        Row{
            anchors.centerIn: parent
            spacing: 30

            A_Button{
                buttonWidth: 150
                buttonHeight: 80
                contentText_Data: qsTr("左  移")

                onButtonPressed: Cpp_PLC.write_into_PLC_Coils(21,true)
                onButtonReleased: Cpp_PLC.write_into_PLC_Coils(21,false)
            }
            A_Button{
                buttonWidth: 150
                buttonHeight: 80
                contentText_Data: qsTr("右  移")

                onButtonPressed: Cpp_PLC.write_into_PLC_Coils(22,true)
                onButtonReleased: Cpp_PLC.write_into_PLC_Coils(22,false)
            }
            A_Button{
                buttonWidth: 150
                buttonHeight: 80
                contentText_Data: qsTr("复  位")

                onButtonPressed: Cpp_PLC.write_into_PLC_Coils(5,true)
                onButtonReleased: Cpp_PLC.write_into_PLC_Coils(5,false)
            }
        }
    }





}
